cmake_minimum_required(VERSION 2.6)
PROJECT(tc_http_server)

AUX_SOURCE_DIRECTORY(./ SRC_LIST)
AUX_SOURCE_DIRECTORY(./common COMMON_LIST)
AUX_SOURCE_DIRECTORY(./jsoncpp JSON_LIST)
AUX_SOURCE_DIRECTORY(./mysql MYSQL_LIST)
AUX_SOURCE_DIRECTORY(./redis REDIS_LIST)
AUX_SOURCE_DIRECTORY(./base BASE_LIST)
AUX_SOURCE_DIRECTORY(./api API_LIST)
AUX_SOURCE_DIRECTORY(./log LOG_LIST)

#SET(LIBRARY_OUTPUT_PATH ./)
SET(EXECUTABLE_OUTPUT_PATH  ./)
if(APPLE)
    SET(PB_LIB_DIR ../base/pb/lib/mac)
elseif(UNIX)
    SET(PB_LIB_DIR ../base/pb/lib/linux)
endif()

ADD_DEFINITIONS( -g -W -Wall -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DAC_HAS_INFO
-DAC_HAS_WARNING -DAC_HAS_ERROR -DAC_HAS_CRITICAL -DTIXML_USE_STL
-DAC_HAS_DEBUG -DLINUX_DAEMON -std=c++14)

INCLUDE_DIRECTORIES(/usr/include/fastdfs /usr/include/fastcommon /usr/local/include/hiredis /usr/include/mysql)
INCLUDE_DIRECTORIES(./ ./include)
INCLUDE_DIRECTORIES(./jsoncpp)
INCLUDE_DIRECTORIES(./mysql)
INCLUDE_DIRECTORIES(./redis)
INCLUDE_DIRECTORIES(./base)
INCLUDE_DIRECTORIES(./api)
INCLUDE_DIRECTORIES(./log)
include_directories()


#ADD_XXXX必须在TARGET_LINK_LIBRARIES前面，否则会报错
#ADD_LIBRARY(${PROJECTNAME} SHARED/STATIC ${SRC_LIST})
ADD_EXECUTABLE(tc_http_server  ${BASE_LIST} ${API_LIST} ${LOG_LIST}
        ${MYSQL_LIST} ${REDIS_LIST} ${JSON_LIST} ${SRC_LIST} ${COMMON_LIST})

TARGET_LINK_LIBRARIES(tc_http_server  pthread fdfsclient fastcommon hiredis m mysqlclient) 
